package com.rent.spider.logs;

import java.io.*;

/*
@李子宁
Happy,happy everyday!
冲鸭！
2021/10/8

*/
public class Specify {

    public static void main(String[] args) {
        File csv = new File("D:\\IntelliJ IDEA-workspace\\HouseRent\\Rent-spiderData\\src\\main\\java\\com\\rent\\spider\\logs\\wawjw.csv"); // CSV数据文件
        try {
            BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream("D:\\IntelliJ IDEA-workspace\\HouseRent\\Rent-spiderData\\src\\main\\java\\com\\rent\\spider\\logs\\wawj" +
                    ".csv")));//换成你的文件名
            OutputStreamWriter out = new OutputStreamWriter( new FileOutputStream(csv ), "UTF-8" );
            BufferedWriter bw = new BufferedWriter( out);
            reader.readLine();
            String line = "";
            while((line=reader.readLine())!=null){
                //明发滨江新城三期 2室1卫1厅 76平精装修 1950元/月,https://nanjing.zu.fang.com/chuzu/3_183259829_1.htm,整租|2室1厅|76㎡|朝南,浦口-桥北-明发滨江新城三期,1950,距3号线柳洲东路站约538米。,https://cdnsfb.soufunimg.com/viewimage/sfb/houseverfiy/2021_9/17/M19/32/a5ff4994-1194-4987-881b-a91f3f686f47/275x207.jpg
                String[] strs = line.split(",");
                StringBuilder sb = new StringBuilder();
                sb.append(strs[1]+",");
                sb.append(strs[2]+",");
                sb.append(strs[0]+",");
                sb.append(strs[3].replace("-",",")+",");
                sb.append(strs[4]+",");
                sb.append(strs[5]+",");
                if(strs.length >= 7) sb.append(strs[6]);

                System.out.println(sb.toString());
                bw.write(sb.toString());
                bw.newLine();
            }
            bw.close();
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
